-
Notifications
You must be signed in to change notification settings - Fork 32
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Maya: Update publish instances via CreateContext + use task attributes instead of folder attributes #358
Maya: Update publish instances via CreateContext + use task attributes instead of folder attributes #358
Conversation
…mes if needed - Also rely on task attributes for resolution and frame ranges instead of folder attributes
This overlaps a tiny bit with #340 since it touches the resolution reset taking it from the task attributes. |
instance_values = { | ||
"folderPath": create_context.get_current_folder_path(), | ||
"task": create_context.get_current_task_name(), | ||
} | ||
creator_attribute_values = { | ||
"frameStart": folder_entity["attrib"]["frameStart"], | ||
"frameEnd": folder_entity["attrib"]["frameEnd"], | ||
} | ||
|
||
has_changes = False | ||
for instance in create_context.instances: | ||
for key, value in instance_values.items(): | ||
if key not in instance or instance[key] == value: | ||
continue | ||
|
||
# Update instance value | ||
print(f"Updating {instance.product_name} {key} to: {value}") | ||
instance[key] = value | ||
has_changes = True | ||
|
||
creator_attributes = instance.creator_attributes | ||
for key, value in creator_attribute_values.items(): | ||
if ( | ||
key not in creator_attributes | ||
or creator_attributes[key] == value | ||
): | ||
continue | ||
|
||
# Update instance creator attribute value | ||
print(f"Updating {instance.product_name} {key} to: {value}") | ||
instance[key] = value | ||
has_changes = True |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any code style tips for this @iLLiCiTiT ? Not sure if the two for loops feel cluttered or whether this makes sense as it is.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changelog Description
Update instances using
CreateContext
to correctly update product names if neededAdditional info
This will fix the updating the the workfile product name when switching between tasks and 'updating publish instances' along.
Testing notes: